package com.unicom.office.dataitem;

import com.unicom.office.var.VarItem;

public abstract class DataItem {
    protected Object value;
    protected VarItem config;

    public DataItem(Object value, VarItem config){
        this.config = config;
        setValue(value);
    }

    public VarItem getConfig(){
        return config;
    }

    public void setValue(Object value){
        if(this.config != null) {
            this.value = config.getFormatedValue(value);
        }else{
            this.value = value;
        }
    }

    public Object getValue(){
        return this.value;
    }

    public String toString() {
        return getValue().toString();
    }
}
